var util = require('../../utils/util.js');
var ajax = require('../../utils/ajax.js');
var common = require('../../utils/common.js');
var PageBase = require('../../common/PageBase.js');
var app = getApp();

Page(common.extendPage(PageBase, {
	data: {
		dataLoaded: false,
	},

	onLoad(options) {
		common.initApp({
			extSuc: () => {
				this._fetch();
			},
			loginSuc: () => {
				this.$loginSuc();
			},
			sysInfoSuc: (sysInfo) => {
				this.setData({
					winHei: app.getWinHei(),
				});
			},
		});
	},

	/**
	 * 拉取页面数据
	 * @return {[type]} [description]
	 */
	_fetch() {
		ajax.G({
			url: '/market/Home/getService',
			success: (res) => {
				var {
					serviceList = []
				} = res.result;

				this.setData({
					dataLoaded: true,
					serviceList
				});
			}
		});
	}

}));